<template>
  <div>
      <el-form  label-width="150px" :model="detail">
                <el-form-item label="名称：">
                    {{detail.content}}
                </el-form-item>
                <el-form-item label="日程时间：">
                    {{detail.startDate+"    "+detail.startTime}}——{{detail.endDate+"    "+detail.endTime}}
                </el-form-item>
                <el-form-item label="分享人：">
                    {{detail.userName}}
                </el-form-item>
                 <el-form-item label="紧急程度：">
                    {{getLevel(detail.level)}}
                </el-form-item>
                 <el-form-item label="发送方式：">
                    {{getSendMode(detail.sendMode)}}
                </el-form-item>
                 <el-form-item label="描述：">
                    {{detail.remark}}
                </el-form-item>
                <el-form-item label="附件：">
                    {{detail.remark}}
                </el-form-item>
           </el-form>
  </div>
</template>

<script>
import {getDetail} from "@/api/oa/schedule/schedule.js";
export default {
    name:'Details',
    props:["id"],

    data(){
        return{
            detail:{},
            leveldictData:[],
            sendModeDictData:[],
        }
    },
    created(){
        // this.getDetail();
        // this.getLevelDict();
        // this.getSendModeDictData();

    },
    watch: {
        id:{
            handler: function(newVal, oldVal) {
                 this.getDetail();
                this.getLevelDict();
                this.getSendModeDictData();
            },
            deep: true,
            immediate: true
        }
    },
    methods:{
        //重要等级字典翻译
        getLevel(level){
          return  this.selectDictLabel(this.leveldictData, level);
        },
      
         //消息提醒的字典翻译
        getSendMode(model){
          return  this.selectDictLabel(this.sendModeDictData, model);
        },
        //获取详情
        getDetail(){
            getDetail(this.id).then(res => {
                console.log(res);
                this.detail = res.data;
            }) 
        },
          //获取重要等级字典
        getLevelDict(){
            this.getDicts("schedule_level").then(response => {
                this.leveldictData = response.data;
            });
        },
         //获取消息提醒方式字典数据
        getSendModeDictData(){
            
            this.getDicts("schedule_send_model").then(response => {
                this.sendModeDictData = response.data;
            });
        },
    }

}
</script>

<style>

</style>